<template>
  <n-config-provider
    :locale="locale"
    :theme="useTheme.darkTheme ? darkTheme : null"
    :theme-overrides="useTheme.naiveThemeOverrides"
  >
    <n-loading-bar-provider>
      <LoadingBar />
      <n-dialog-provider>
        <DialogContent />
        <n-message-provider>
          <MessageContent />
          <n-notification-provider>
            <NotificationContent />
            <slot></slot>
          </n-notification-provider>
        </n-message-provider>
      </n-dialog-provider>
    </n-loading-bar-provider>
  </n-config-provider>
</template>

<script setup>
import { ref } from 'vue'
import { enUS, zhCN } from 'naive-ui'
import { darkTheme } from 'naive-ui'
import MessageContent from './MessageContent.vue'
import DialogContent from './DialogContent.vue'
import LoadingBar from './LoadingBar.vue'
import { useThemeStore } from '@/store/modules/theme'
import { useLanguage } from '@/hooks/useLanguage.js'
import { useAppStore } from '@/store/modules/app.js'
import NotificationContent from './NotificationContent.vue'
const useTheme = useThemeStore()
const appLanguage = useLanguage()
const appStore = useAppStore()
let locale = ref(null)
appLanguage.setLanguage(appStore.lang)
appStore.lang === 'zh_CN' ? (locale.value = zhCN) : (locale.value = enUS)
</script>
